package blog.controller;

import blog.pojo.ResultVo;
import blog.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author HuLin
 * @date
 */
@RestController
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    public BlogService blogService;

    @GetMapping("/{cid}")
    public ResultVo selectBlogByCid(@PathVariable Integer cid){
	  ResultVo resultVo = blogService.selectBlogByCid(cid);
	  return resultVo;
    }

    @GetMapping("/detail/{bid}")
    public ResultVo selectBlogByBid(@PathVariable int bid){
        return blogService.selectBlogByBid(bid);
    }

    @GetMapping("/likes/{bid}")
    public ResultVo addLikes(@PathVariable Integer bid){
        return blogService.addLikes(bid);
    }
}
